package com.laboratory.eventlistenerlearning.listener;

import com.laboratory.eventlistenerlearning.event.DeptEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 部门事件监听器
 */
@Async
@Component
public class DeptListener implements ApplicationListener<DeptEvent> {

    @Override
    public void onApplicationEvent(DeptEvent event) {
        System.out.println("DeptListener.onApplicationEvent()");
        System.out.println(event.getDepartmentName() + ":" + event.getMessage());
    }

}
